//
//  MyPage.m
//  TodayComment
//
//  Created by 张吉阳 on 15/9/12.
//  Copyright (c) 2015年 xianrenmoshi. All rights reserved.
//

#import "MyPage.h"
#import "FxTabBar.h"
#import "FxDBManager.h"
#import "MyCell.h"

@interface MyPage ()
@end
@implementation MyPage
- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setNavigationLeft:@"1.png" sel:@selector(doBack:)];
    self.view.nightBackgroundColor = UIColorFromRGB(0x343434);
    _arrayList = @[];
   
}


- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    [self.tabBarController.view addSubview:_tabBar];
    
}


- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
    [_tabBar removeFromSuperview];
}

#pragma mark - FxTabBarDelegat Method
- (IBAction)doBack:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)tabBar:(FxTabBar *)tabBar didSelectIndex:(NSInteger)index
{
    
    if (index == 0) {

        [self.navigationController popViewControllerAnimated:YES];
    }
    
}

#pragma mark - UITableViewDelegate & UITableViewDataSource methods

-(void)tableView:(UITableView *)tableView  willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath*)indexPath
{
    [cell setBackgroundColor:[UIColor clearColor]];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 120;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _arrayList.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *info = nil;
    MyCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyCell"];
    info = [_arrayList objectAtIndex:indexPath.row];
    if (cell == nil) {
        NSArray* Objects = [[NSBundle mainBundle] loadNibNamed:@"MyCell" owner:tableView options:nil];
        cell = [Objects objectAtIndex:0];
    }
    [cell setCellData:info];
    return cell;

}

@end
